<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/layui/layui_2/layui/css/layui.css"
	media="all">
	<style type="text/css">
        .layui-table-cell {
            height: 50px;
            line-height: 55px;
            text-align: center;
        }
    </style>
</head>
<body>
	<table class="layui-table" id="emp_recovery_table" lay-filter="emp_recovery_table"></table>
	<script src="${pageContext.request.contextPath }/layui/layui_2/layui/layui.js"></script>
	<script>
		layui.use(['form','element','jquery','table','layer'], function() {
			var form = layui.form,
				element = layui.element,
				$ = layui.jquery,
				table = layui.table,
				layer = layui.layer;
			
			var cols = [ [ {
				field : 'e_id',
				align : 'center',
				title : '员工编号',
				width : 150
			},{
				align : 'center',
				title : '所在部门',
				width : 150,
				templet: '<div>待议</div>'
			}, {
				field : 'e_loginname',
				title : '登录名',
				align : 'center',
				width : 150
			}, {
				field : 'e_psw',
				align : 'center',
				title : '登录密码',
				width : 150
			}, {
				field : 'e_img',
				align : 'center',
				title : '员工头像',
				width : 150,
				templet: '<div><img src="{{d.e_img}}" style="width: 50px;height: 50px;"/></div>'
			}, {
				field : 'e_sex',
				align : 'center',
				title : '员工性别',
				width : 150
			}, {
				field : 'e_flag',
				align : 'center',
				title : '员工类别',
				width : 150,
				templet: '#flag'
			}, {
				field : 'e_admin',
				align : 'center',
				title : '权限级别',
				width : 150,
				templet: '#admin'
			}, {
				field : 'e_truename',
				align : 'center',
				title : '员工真实姓名',
				width : 150
			}, {
				field : 'e_remark',
				align : 'center',
				title : '员工备注',
				width : 150
			}, {
				title : '操作',
				align : 'center',
				toolbar : '#recovery',
				width : 200
			} ] ];
			
			//方法级渲染
			table.render({
				elem : '#emp_recovery_table',
				url : '${pageContext.request.contextPath }/empAction_findRecoverByPage',
				cols : cols,
				id : 'testReload',
				limit: 10,
			    limits: [10, 30, 50],
				page : true
			});
			
			//监听工具条
			table.on('tool(emp_recovery_table)', function(obj){
			    var data = obj.data;
			    if(obj.event === 'recovery'){
			     	layer.open({
						type: 2,
						title: '恢复员工',
						skin: 'layui-layer-molv',
						shadeClose: true,
						shade: 0.5,
						area: ['460px', '260px'],
						content: "${pageContext.request.contextPath }/empAction_recoveryFindById?e_id="+data.e_id
					})
			     }
			 });
			
		})
		
	</script>
	
	<script type="text/html" id="sex">
  		{{#  if(d.e_sex = 1){ }}
    		男
  		{{#  } else { }}
    		女
  		{{#  } }}
	</script>
	<script type="text/html" id="flag">
  		{{#  if(d.e_flag = 1){ }}
    		部门主管
  		{{#  } else { }}
    		普工
  		{{#  } }}
	</script>
	<script type="text/html" id="admin">
  		{{#  if(d.e_admin = 1){ }}
    		部门主管
  		{{#  } else { }}
    		普通操作者
  		{{#  } }}
	</script>
	<script type="text/html" id="recovery">
		<i class="layui-icon">&#xe616;</i><a class="layui-btn layui-btn-mini" lay-event="recovery">恢复员工</a>
	</script>
</body>
</html>